
//
//  HomBottomView.m
//  QuantumWar
//
//  Created by mysj on 16/7/19.
//  Copyright © 2016年 zeng. All rights reserved.
//

#import "HomBottomView.h"
#import <Masonry.h>



@interface HomBottomView ()

@property (nonatomic, strong) UIImageView *topImgView;
@property (nonatomic, strong) UIImageView *bottomImgView;
@end

@implementation HomBottomView

- (void)setImageNames:(NSArray *)imageNames {

    self.topImgView.image = [UIImage imageNamed:imageNames[0]];
    self.bottomImgView.image = [UIImage imageNamed:imageNames[1]];
    [self.correspondedBtn setImage:[UIImage imageNamed:imageNames[2]] forState:UIControlStateNormal];
}
- (instancetype)init {
    if ( self = [super init] ) {
        
        [self prepareSubviews];
    }
    return self;
}

- (void)prepareSubviews {
    
    [self addSubview:self.correspondedBtn];
    [self addSubview:self.topImgView];
    [self addSubview:self.bottomImgView];
    
    [self.correspondedBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.bottom.equalTo(self);
        make.width.equalTo(@75);//150 74
//                make.height.equalTo(@37);
    }];
    
    [_topImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self);
        make.right.equalTo(self.correspondedBtn.mas_left);
        make.bottom.equalTo(_correspondedBtn.mas_bottom).offset(2);
    }];
    
    [_bottomImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self);
        make.right.equalTo(self.correspondedBtn.mas_left);
        make.height.equalTo(@2);
    }];
}

#pragma mark -

- (UIButton *)correspondedBtn {
    if (_correspondedBtn == nil) {
        _correspondedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    }
    return _correspondedBtn;
}

- (UIImageView *)topImgView {
    if (!_topImgView) {
        _topImgView = [[UIImageView alloc] init];
    }
    return _topImgView;
}

- (UIImageView *)bottomImgView {
    if (!_bottomImgView) {
        _bottomImgView = [[UIImageView alloc] init];
    }
    return _bottomImgView;
}

@end
